Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup a NULL provider #2

Merged
merged 6 commits into from
Feb 20, 2024
Merged

Setup a NULL provider #2

merged 6 commits into from
Feb 20, 2024

Conversation

gowthamsk-arm
Copy link
Collaborator

@gowthamsk-arm gowthamsk-arm commented Jan 8, 2024

This PR adds NULL provider functionality as a basic setup. There are 4 crates defined in the repo:

  1. openssl-sys2 - provides bindings missing from the existing openssl crate
  2. openssl2 - provides error handling and additional openssl related support functions
  3. parsec-openssl-provider - static library implementing the NULL provider
  4. parsec-openssl-provider-shared - dynamic library setup needed for openssl

Apart from these, there are some basic test files (ci.sh and docker image) that will be part of the CI setup testing the implementation.

Signed-off-by: Gowtham Suresh Kumar [email protected]

@gowthamsk-arm
Copy link
Collaborator Author

Will breakdown the commits so its easier to review.

@gowthamsk-arm gowthamsk-arm force-pushed the null_provider branch 4 times, most recently from 86e7c96 to 8bb0be2 Compare January 16, 2024 18:24
Copy link
Member

@tgonzalezorlandoarm tgonzalezorlandoarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I see that we are dealing with conversions from c and rust in the provider itself. I think it would be good to have an abstraction layer on the openssl2 layer which handles the conversions, and on the provider we just deal make calls to those conversions to get safe Rust types, so that we only deal with Rust on the provider level.
  2. Some nits/things to check and minor changes

openssl-sys2/Cargo.toml Outdated Show resolved Hide resolved
openssl2/Cargo.toml Outdated Show resolved Hide resolved
openssl-sys2/src/lib.rs Outdated Show resolved Hide resolved
openssl-sys2/src/types.rs Outdated Show resolved Hide resolved
parsec-openssl-provider/src/lib.rs Outdated Show resolved Hide resolved
parsec-openssl-provider-shared/src/lib.rs Outdated Show resolved Hide resolved
openssl-sys2/src/types.rs Outdated Show resolved Hide resolved
openssl-sys2/src/types.rs Outdated Show resolved Hide resolved
openssl-sys2/src/types.rs Outdated Show resolved Hide resolved
openssl-sys2/src/types.rs Outdated Show resolved Hide resolved
@gowthamsk-arm
Copy link
Collaborator Author

I see that we are dealing with conversions from c and rust in the provider itself. I think it would be good to have an abstraction layer on the openssl2 layer which handles the conversions, and on the provider we just deal make calls to those conversions to get safe Rust types, so that we only deal with Rust on the provider level.

Yes thanks for comment. Will fix this. :)

@tgonzalezorlandoarm
Copy link
Member

Should we also add the .h header files with the necessary information for calling bindgen (and include bindgen in the Cargo.toml) so that we can regenerate the bindings for any platforms? This would be consistent with our approach on the rest of the projects

@gowthamsk-arm
Copy link
Collaborator Author

This approach would be better. Will make the changes.

openssl2/src/lib.rs Outdated Show resolved Hide resolved
@gowthamsk-arm gowthamsk-arm force-pushed the null_provider branch 2 times, most recently from f047feb to 40e59fb Compare February 6, 2024 11:06
Copy link
Member

@tgonzalezorlandoarm tgonzalezorlandoarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and changes requests

Cargo.toml Outdated Show resolved Hide resolved
parsec-openssl-provider-shared/src/catch.rs Outdated Show resolved Hide resolved
parsec-openssl-provider/src/catch.rs Outdated Show resolved Hide resolved
parsec-openssl-provider-shared/src/catch.rs Outdated Show resolved Hide resolved
openssl-sys2/src/c/openssl.h Outdated Show resolved Hide resolved
openssl2/Cargo.toml Outdated Show resolved Hide resolved
openssl2/Cargo.toml Outdated Show resolved Hide resolved
parsec-openssl-provider-shared/src/catch.rs Show resolved Hide resolved
parsec-openssl-provider/src/provider.rs Show resolved Hide resolved
parsec-openssl-provider/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, so far so good

openssl2/src/lib.rs Outdated Show resolved Hide resolved
@gowthamsk-arm gowthamsk-arm force-pushed the null_provider branch 10 times, most recently from 1f3d23a to 9965c81 Compare February 13, 2024 14:10
ci.sh Outdated Show resolved Hide resolved
@gowthamsk-arm gowthamsk-arm force-pushed the null_provider branch 2 times, most recently from 719e5ff to 9809d8d Compare February 13, 2024 17:20
Copy link
Member

@tgonzalezorlandoarm tgonzalezorlandoarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@tgonzalezorlandoarm tgonzalezorlandoarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid using the imports with "crate::*"

For example "openssl2::*".
Let's avoid collisions and be specific about what we import.

@gowthamsk-arm gowthamsk-arm force-pushed the null_provider branch 3 times, most recently from 818e9ec to 40e4b1d Compare February 15, 2024 16:53
Copy link
Member

@tgonzalezorlandoarm tgonzalezorlandoarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

ionut-arm
ionut-arm previously approved these changes Feb 15, 2024
Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@@ -0,0 +1,77 @@
// Copyright 2023 Contributors to the Parsec project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this technically be 2024?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started the PR work in 2023 December :) So kept it. Should I switch to 24?

This patch adds supports for building bindings for the missing
provider related bindings and other required types.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>
This patch adds macros and other functions required for setting up
the provider.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>
This patch adds the NULL provider functionality without any crypto
support. The idea of this patch is to provide a working openssl provider
to add features on top off.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>
This adds a new crate which helps in building a dynamic library
for the parsec provider.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>

shared merge
The CI script is now updated with build steps and basic test commands
to verify the dynamic loading of the parsec provider.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>
@gowthamsk-arm
Copy link
Collaborator Author

Rebased the PR.

Copy link
Member

@tgonzalezorlandoarm tgonzalezorlandoarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gowthamsk-arm gowthamsk-arm merged commit ec17350 into main Feb 20, 2024
5 checks passed
@gowthamsk-arm gowthamsk-arm deleted the null_provider branch February 22, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants